package work;

import java.util.Scanner;

/*
10 编程,求一个x 的n次方
 */
public class Work10 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入x:");
        int x = scanner.nextInt();
        System.out.println("请输入n:");
        int n = scanner.nextInt();
        int sum = xToN(x,n);
        System.out.println(x+"的"+n+"次方为"+sum);
    }
    static int xToN(int x,int n){
        int sum = 1;
        for (int i = 0; i < n; i++) {
            sum = sum *x;
        }
        return sum;
    }
}
